import request from "@/utils/request";
import type {
  attrListModel,
  attrModel,
  categoryIdsModel,
} from "./model/AttrModel";
/* 
GET /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id}
DELETE /admin/product/deleteAttr/{attrId}
POST /admin/product/saveAttrInfo
*/
//获取
export const getAttrInfoListApi = (params: categoryIdsModel) => {
  return request.get<any, attrListModel>(
    `/admin/product/attrInfoList/${params.category1Id}/${params.category2Id}/${params.category3Id}`
  );
};

//新增或者修改
export const saveAttrInfoApi = (attr: attrModel) => {
  return request.post("/admin/product/saveAttrInfo", attr);
};

//删除
export const deleteAttrApi = (attrId: number) => {
  return request.delete(`/admin/product/deleteAttr/${attrId}`);
};
